package com.matrix.media.controller;

import com.matrix.common.entity.PageResult;
import com.matrix.common.entity.Result;
import com.matrix.common.exception.CommonException;
import com.matrix.media.constant.MediaError;
import com.matrix.media.dto.MixedCutProjectDTO;
import com.matrix.media.dto.MixedCutProjectPageQueryDTO;
import com.matrix.media.entity.project.MixedCutProject;
import com.matrix.media.service.MixedCutProjectService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@ApiOperation("视频混剪项目")
@CrossOrigin
@Slf4j
@RestController
@RequestMapping("/matrix/mixedCut")
public class MixedCutProjectController {

    @Autowired
    MixedCutProjectService mixedCutProjectService;

    @ApiOperation("查询混剪项目分页")
    @GetMapping("/page")
    public Result<PageResult> queryMixedProjects(MixedCutProjectPageQueryDTO pageQueryDTO) {
        PageResult pageResult = mixedCutProjectService.pageQuery(pageQueryDTO);
        log.info(String.valueOf(pageResult));
        return Result.success(pageResult);
    }

    @PostMapping("/project")
    public Result addMixedCutProject(@RequestBody MixedCutProjectDTO projectDTO) {
        mixedCutProjectService.addMixedCutProject(projectDTO);
        return Result.success();
    }
}
